package com.sscaipiao.android.activity.Base;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.sscaipiao.android.R;

/**
 * Created by ppona_000 on 13-12-30.
 */
//BaseUIActivity  BaseActivity??,??title,scroll,bottombar

public class BaseUIListActivity extends BaseActivity implements View.OnClickListener {

	private TextView mTitleText;
	private Button mTitleBack;
	private LinearLayout mPartMain;


	private onClickCallback mCallback ;
	public interface onClickCallback{
		void onBaseViewClick(View view);
	}
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.base_ui_list_activity);
		mTitleText = (TextView) findViewById(R.id.title_text);
		mTitleBack = (Button) findViewById(R.id.title_back);
		mTitleBack.setOnClickListener(this);
		mPartMain = (LinearLayout) findViewById(R.id.part_main);
	}
	public void addContainerMain(int container_id) {
		LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
		View layout = inflater.inflate(container_id,null);
		if (layout != null) {
			mPartMain.addView(layout);
		}
	}
	public void setTitleText(String string) {
		if (mTitleText != null) {
			mTitleText.setText(string);
		}
	}
	public void setTitleText(int id) {
		if (mTitleText != null) {
			String title = getResources().getString(id);
			setTitleText(title);
		}
	}

	public void setupUI(boolean bShowBack, boolean bShowArrow,boolean bShowHis,boolean bShowRadom, boolean bShowBottom) {
		mTitleBack.setVisibility(bShowBack == true ? View.VISIBLE : View.GONE);
	}

	public void setCallback(onClickCallback cb) {
		mCallback = cb;
	}

	@Override
	public void onClick(View v) {
		if (v == mTitleBack) {
			finish();
		}


	}


}